import request from '@/utils/request'
import useSetStore from '@/store/modules/set'

// 查询环境
export function env() {
  return request({
    url: '/app_api/system/config/env',
    method: 'get'
  })
}

// 上传图片
export function upload(tempFilePath) {
	return new Promise((resolve, reject) => {
		const setStore = useSetStore()
		uni.uploadFile({
		  url: setStore.baseUrl + '/app_api/common/upload',
		  filePath: tempFilePath,
		  name: 'file',
		  success(res) {
			  if (res.statusCode == 200) {
			  	resolve(res)
			  } else {
			  	reject(res.msg)
			  }
		  },
		  fail(err) {
			  reject(err)
		  }
		})
	})
}
// 查询配置
export function sysProperties(key) {
  return request({
    url: `/app_api/sys/properties/all`,
    method: 'get'
  })
}
// 区域
export function allProvince() {
  return request({
    url: '/app_api/base-region/all-province',
    method: 'get'
  })
}
// 全部省市区
export function allRegion() {
  return request({
    url: `/app_api/base-region/all-region`,
    method: 'get'
  })
}
// LOGO
export function navigationLogo() {
  return request({
    url: '/app_api/navigation/logo',
    method: 'get'
  })
}
// 名称
export function navigationName() {
  return request({
    url: '/app_api/navigation/name',
    method: 'get'
  })
}
